mod crop;
mod resize;

use clap::Parser;

#[derive(Debug, Parser)]
#[clap(name = "cargo")]
#[clap(bin_name = "image-tool")]
#[clap(author, version, about="图片工具集", long_about=None)]
enum ImageTool {
    Resize(resize::Resize),
    Crop(crop::Crop),
    NPG(crop::NinePalaceGrid),
}
fn main() {
    match ImageTool::parse() {
        ImageTool::Resize(args) => resize::resize(
            args.input.as_str(),
            args.output.as_str(),
            args.width,
            args.height,
        ),
        ImageTool::Crop(args) => crop::crop(
            args.input.as_str(),
            args.output.as_str(),
            args.left,
            args.top,
            args.width,
            args.height,
        ),
        ImageTool::NPG(args) => crop::nine_palace_grid_crop(&args.input, &args.output),
    }
}
